﻿using Minotaur.App.Domains.Model.Personal;

namespace Minotaur.App.Domains.Model.Position
{
    [SugarTable("Position")]
    public class Position : EntityBase
    {
        [SugarColumn(ColumnName = "autoid", IsIdentity = true, IsPrimaryKey = true)]
        public virtual int AutoId { get; set; }

        [SugarColumn(ColumnName = "parentid")]
        public virtual int ParentId { get; set; }

        [SugarColumn(ColumnName = "positioncode")]
        public virtual string? Positioncode { get; set; } 

        [SugarColumn(ColumnName = "orgid")]
        public virtual int? OrgId { get; set; }

        /// <summary>
        /// 组织类型
        /// 公司、部门
        /// </summary>
        [SugarColumn(ColumnName = "orgtype")]
        public virtual string? OrgType { get; set; }


        [SugarColumn(ColumnName = "enable")]
        public virtual bool Enable { get; set; }


        [SugarColumn(ColumnName = "sequence")]
        public virtual long? Sequence { get; set; }

        [SugarColumn(ColumnName = "havedelete")]
        public virtual bool HaveDelete { get; set; }

        /// <summary>
        /// 职位类型
        ///  1-主管职位，0-负责人，2-分管领导，3-员工,4-法人
        /// </summary>
        [SugarColumn(ColumnName = "positiontype")]

        public virtual int PositionType { get; set; }

        /// <summary>
        /// 资源
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(PositionRes.PositionId))]
        public virtual List<PositionRes> Res { get; set; }

        /// <summary>
        /// 职位
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(Employee.PositionId))]
        public virtual List<Employee> Employees { get; set; }
        /// <summary>
        /// 职位
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(OrgId), nameof(Organization.Organization.AutoId))]
        public virtual Organization.Organization Org { get; set; }
    }
}
